import pickle
import pandas as pd
from sklearn.ensemble import AdaBoostRegressor
import util

Xcols = ['eirp',
          'ap_from_ap_0_max_ant_rssi', 'ap_from_ap_0_mean_ant_rssi', 'ap_from_ap_0_sum_ant_rssi',
          'ap_from_ap_1_max_ant_rssi', 'ap_from_ap_1_mean_ant_rssi', 'ap_from_ap_1_sum_ant_rssi',
          'sta_from_ap_0_max_ant_rssi', 'sta_from_ap_0_mean_ant_rssi', 'sta_from_ap_0_sum_ant_rssi',
          'sta_from_ap_1_max_ant_rssi', 'sta_from_ap_1_mean_ant_rssi', 'sta_from_ap_1_sum_ant_rssi',
          'sta_to_ap_0_max_ant_rssi', 'sta_to_ap_0_mean_ant_rssi', 'sta_to_ap_0_sum_ant_rssi',
          'sta_to_ap_1_max_ant_rssi', 'sta_to_ap_1_mean_ant_rssi', 'sta_to_ap_1_sum_ant_rssi']

modelName = '3ap'
adaboost = util.loadModel(modelName + '.pkl')

def predTestCsv(filename):
    testData = pd.read_csv(filename + '.csv')
    testX = testData[Xcols]
    testY = adaboost.predict(testX)
    print(testY)
    testData['seq_time'] = pd.Series(testY)
    testData.to_csv(filename + '_predSeqTime.csv')
predTestCsv('test_set_1_' + modelName + '_ReduceRssi')
predTestCsv('test_set_2_' + modelName + '_ReduceRssi')